#!/sbin/openrc-run

name=strfry
description="Strfry Nostr relay"

: ${STRFRY_CONFIG:="/etc/strfry.conf"}
export STRFRY_CONFIG

command="/usr/sbin/strfry"
command_args="relay"
command_background="yes"
command_user="strfry:strfry"
pidfile="/run/${RC_SVCNAME}.pid"
output_log="/var/log/strfry.log"
error_log="/var/log/strfry.log"

required_files="$STRFRY_CONFIG"

depend() {
	need localmount net
	after firewall
}

start_pre() {
	checkpath -q -f -m 0640 -o "$command_user" \
		"$STRFRY_CONFIG" "$output_log" "$error_log"

	checkpath -q -d -m 0750 -o "$command_user" \
		/var/lib/strfry
}
